improve agenda code