Updating degree functionality to inlude a selfloop parameter and make a little more efficient.