Cleanup + Persistence

Cleaned up code, changed IO to Streams, added Persistence.