added normalizeSpaces