Changed open_with_unicode interface, and cleaned up redundant code.