Make sure the callback is never called before the exported function returns.
Minor code cleanup - colorized some messages