Refine frontend_loop some more