Revert to d2cf8f794504ecb289cb6bc690ee936ee02151de
expand the algorithm to resolve all cases
update README example and rebuild