Refactored single_screenshot.js