Cleaned up code, distortion

More or less a rewrite, but it should be pretty now!
Fixed distortion values