Added shutdown method to main class.