updated routineGenerator