move registration code to corresponding cpp files.