move changed count and screenshot logic to model