modified flatmap to for expression