Lab4 code