Initial and inefficent implementation of selection.