streamlining select function