Added on shutdown hook
Added startup hooks