Attempt to fix calcDirection()