Added saving index conditionally.  Basically done.