added range and factorial