lab 2 - updated code