as you changed this to else if, you can leave out the `if (valid` ... on this line