reorganized callbacks

Reorganized registration of callbacks for #158