Updated variable saving

Much better than original, as always.
Merge pull request #17 from SeanScottDuke/master

Updated variable saving