Clean up code
Add persistence code

Add persistence logic; clean up code & remove obsolete code