adding flatten