Cleaned code of basic agent.