finished assn3 implementation