Major surgery to produce Works for 505, specifically to deal with Agents.  New supporting function added.