added support for variable DOF