Move selection stuff to its own file.