Refactored lab 1.