refactor agent.h
fix variable names
fix function names in util.h