Fix ordering of config and service parts

Also extract the parts into subclasses and add tests :)