added gui support in castling