Add condition to final exercise and simplify everything

I left out the condition on one exercise for no good reason. Including it makes everything a lot simpler.

#44618