Implemented simple error detection
Merged error detection