Refactored how valid pieces with valid moves are found to be 1 function thus fixing a bug with previous function for finding valid moves