created isValidMove method