added comments for error correction algorithm