Add checks and tests for valid input to the move function