Remove unnecessary flatMap.
Rename type to types to better express what it is and avoid quoting.