Refractor some files