Massive refactor part 2 ...