only show generated code if the user can continue on to the next level; some light refactoring