Some code reforming in mod3 assignment