hypnos.open function rewritten