complete implementation of auto-reload when data changes