Implemented error correction, still need to test.