Changed while statement case, need to be less than num rather than less than half the num