Cycles in math unrolled back for better performance