renamed limit to ranges in functions to prevent confusion