added save and decode