start of the Cycle Bases function