Various refactorings and tidy up of user_map. All tests pass for me.
Updated project files.