Accounted for negative numbers and numbers higher than 9999.