Relocated command quoting to be smarter