Added save and auto-save functionality