move RAC code into private functions