removed infinite loop. added wait on input instead.