Bug correction (first number in the range > second number) + clean some code