closes #1977 and takes parameters with quotes and spaces into account as well now