Changed selection to account for dataTypes. Lots of repeated code...