starting code refactoring