add support for castling and better board recognition