Added castling, fixed bugs