Cleaned up the movement codes a bit