clean up routing code