Lab2, Ex1: Refactored