simplified setLastSync so it is more predictable and testable; also removed some print_r's; updated interfaces to ensure lastSync handler is implemented correctly