refactored Router class