Refactor out sysconfig handling