Implemented save functionality