final version of lab 2 (not tested)