More efficient constrained DoF indexing

Practicing my first pull request using an outstanding patch