Saving functionality added (untested).