added save functionality (untested)