refactor all the old stuff