Queue save to file refactored