public final int gen_caps_and_promotions(Move[] moves, int startIndex) {
		int moveIndex = gen_caps(moves, startIndex);
		int from,to,pieceType;
		if(toMove == WHITE_TO_MOVE) {
			for (int i = 0; i < w_pawns.count; i++) {
				from = w_pawns.pieces[i]; // Index the current pawn is on
				to = from + 16; // Up
				pieceType = boardArray[to];

				// Pawn can move forward
				if (pieceType == EMPTY_SQUARE) 	{
					// Reached the last rank add promotion
					if (rank(to) == 7) 	{
						moves[moveIndex++].move = Move.createMove(W_PAWN, from, to, 0, PROMOTION_QUEEN, 0);
					}
				}
			}
		} else { // Black to move
			for (int i = 0; i < b_pawns.count; i++) {
				from = b_pawns.pieces[i]; // Index the current pawn is on
				to = from - 16; // Down
				pieceType = boardArray[to];
				if (pieceType == EMPTY_SQUARE) {
					if (rank(to) == 0) {
						moves[moveIndex++].move = Move.createMove(B_PAWN, from, to, 0, PROMOTION_QUEEN, 0);
					}
				}
			}
		}
		return moveIndex;
	} // END gen_caps_and_promotions