Changes from mjc:  Callback returns an int.  Minor fixes.
Minor cleanup and bug fix.