update to avoid global variables
Incorporating changes from Ben Kirk to use the new system assembly format (use objects instead of function pointers)