add flatmap to testing