Working prototype code with gracefull shutdown and notification