added solution for lab 3. May be incorrect