Mode code cleanup - formatting