start refactoring code