Refactor setup logic massively