Refractor files and code