step 4: copied lab04 code