finished refactoring structure