Factorize input range detection func #10