Added saving, refactored design, added tests.
Merge pull request #1 from saibotsivad/add-saving

Added saving, refactored design, added tests.