integrating DegreeOfFreedom class int othe rest of the code