refactored server router for rerouting