Another broken commit, but cleaning and reorganizing some code