Major refactoring

- adding alert recovery attempter
- improving comments
- fixing warnings
Adding error code to string methods