Seniority as a tool for truncating configuration interaction wave functions, and constructing pair Hamiltonians