Heya, First draft patch to split the agents away from the main program. Seems to work fine for me. This is mostly moving functions around though. Cheers