cleaned user management library and added tests