You have the same degree check twice, I assume one of these is supposed to be inputOrder?