Rework serialization code & add 'exists' support