Restructure some files and prepare to refactor