Isolate all validation checks into one function. Improve code readablity, many minor bits here and their