Add no_messages to register_name functions and clean up the code