refactored design