Refactor the crash and bug reporting