added save leftover data capability