Huge refactoring: adding DOFs
mostly finished refactor -- needs debugging