Refactoring to simplify structure