fixed typo
improved quit and restart coding