adding save functionality