Add interval saving and "properly" exit