Refactor configuration handling, class vs instance methods, etc.

[#82948310]

Also, direct upload, whitespaces, empty lines at the end of files.