Rewrite of psnapshot for better maintainability

- Add DSL
- Add comments to function bodies
- Add test harness