handling space and case edgecase