refactored stucture