refractor and remove some files