refactored router