working on save functionality