Added comments and a shutdown hook