refactor Flash Message code