castling: preliminary implementation