move ranges and paths reading to new func