lab4v2: basic functionality is done, now need implement OPTIMAL way