working on shutdown mechanism