removed global agent, and refactored shared code from screenshot, thumbnail, and common core