rearranged codes inside pawn promotion function. Removed some codes related to castling