Code refactoring

Register method split into registerClass and registerFunctio