Cleans up and refactors verify code and adds more specific error messages.