calculating the degrees works until it reaches 180