added smaller version of flatmap