input query should be downcased
rename deepmap to more descriptive: flatmap
had to flatten the results of flatmap