♻️ Move output generation to state