added code for DoF