Refactoring to new structure