Renames map to flatMap

Also creates flatten and map