Massive refactoring. Implicits still need to be reordered