Refactored to new structure