reorganized routing and added stat tracking