Refactor files and setup directives