refactored heavily by having all agents be variants of a single Agent datatype