minimize differences to original code