Refactoring

I refactored the crash report code. I moved it to a class, added unit test to it and updated the code that uses it.