Refactored lab2