refactored and simplified