fixing style, moving graceful-shutdown logic into scheduler