Refactored save scenario tools. Fix #810.