Massive refactor part one