little refactoring of user-related functionality