Cleaned up routing code.