Added functionality for quitting