Added the shutdown function