edited quit-function