Finished refactoring whole structure