prepared testing mode for saveInSession

Several mods and code cleanup