Commenting and reorganizing code