start refactoring code
registration refactoring
refactoring #2