Refactoring basic structure