modified some saving procedures. still needs tweaking