Further refactoring user_map. All tests pass for me.