Added document open function