Attempted to fix open-first function