implemented pluck variation of flatten method