lab1 refactoring