Slight refactoring of $user module