Refactored, introduced check_if_stopped to make sure we stop even if the last move was sidewards