Refactor cgroup init

Makes init a little cleaner, code wise.