Moved screenshot code into a class, making room for easier expansion.