Cleaning up routing code