public Set<ChessPiece> filterMoves(Set<ChessPiece> possibleMoves, ChessPiece[][] board) {
			ChessPiece[][] tempBoard = new ChessPiece[8][8];
			Set<ChessPiece> checkedMoves = new HashSet<ChessPiece>();
			//copy the board over piece by piece, to eliminate aliasing
			//also, find the coordinates of the selected piece
			for(int i = 0; i < 8; i++) {
				for(int j = 0; j < 8; j++) {
					tempBoard[i][j] = board[i][j];
					if(board[i][j] == this) {
						tempBoard[i][j] = new ChessPiece(i,j);
					}
				}
			}
			
			for(ChessPiece move : possibleMoves) {
				int rowMove = -1;
				int colMove = -1;
				for(int i = 0; i < 8; i++) {
					for(int j = 0; j < 8; j++) {
						if(tempBoard[i][j] == move) {
							rowMove = i;
							colMove = j;
							i = 8; //to break from outerloop
							break;
						}
					}
				}
				ChessPiece previousPiece = tempBoard[rowMove][colMove];
				tempBoard[rowMove][colMove] = this;
				if(!ChessBoard.inCheck(this.color, tempBoard)) {
					checkedMoves.add(move);
				}
				tempBoard[rowMove][colMove] = previousPiece;
			}
			
			return checkedMoves;
		}