WIP

- Moving the writer to subroutines
- Clean the code around the creation of file and paths