Most of this validation code is the same as before, you could probably pull all this out into another function.