totally rewritten agent