code clean up and bug fixes to notify