Finished refactoring!

Made substantial changes to simplify the movement calculations