main cycle fix-added second cycle fixed