creates goups file, calculates ranges