The open() method refactored.