Added proper shutdown procedure