remove duplicated whitespace-checking routine