Moved castling logic with other move logic.