Added some utility functions for selection.