using lab4 as starting template