refactor simple reflex agent