add free degree calculation procedure