added checks to see if move is valid. edge cases still probably exist