wrote shell for shutdown function and improved the error hadnling/signal catching