added loop quiting from q input