handle escaping of spaces, remove debugging code