Extracted some authentication functionality to more generic objects validation and function; some minor renaming