refactored router
fixed client-side sorting issue