Move slice sorting to a new file.
Added intersection.