implemented saving feature