Refactor and config

I added the ability to have a configuration file specifying the screenshot destination path, file format and always upload option.

In the process I took the time to make some major refactoring to make the code easier to understand and maintain.