Solution to incomplete code