refactoring, castling (wip)