final solution to lab5