added getDegree function