Refactor generation code.
Do not put treasures near exits.