Refactor set generation, WIP