Making select operation more generalizable