refactored the structure