modified lab2 code, which is an alternate (not working but clearer) view of lab2