Add saving option and better handling of files