Implement Save function

Fixes #2 plus very minor fixes.