Refactor out sysconfig handling

OK, agreed