user management code cleaned up