added utility methods to User; refactoring