Refactor serialiation code to return result objects instead of using spurious callbacks for synchronous code.  Also, refactor test routines to be more DRY.