Move class and performMove

Lots of helper functions too