// Backup of original viewer.js - performance-focused rewrite in progress