More WIP, mainly to implement config files. I'm not even sure this works properly at this particular commit.