updated degree function