Almost finished Lab3. Only the solve function left.