refactored the router module