Refactor panic event module