Massive refactor to use better style everywhere