Proper shutdown added