code cleanup and make completion notification email async