Added generate_routes, fixed cleaning bug