Moved rnea_loops to separate file