refactoring (doing a small re-design for castling)