Code refactoring to simplify snapshot and delta handling