lab4 implemented