Introduced validate_user(). #857
reorganized functions. #857