Clean up router code