solution to variable improvment exercise