Tweaked correction algorithm again