0.01: Copied from widmp and flipped the phase directions!
0.02: Minor code improvements
