Refactor, reformat logging, add nested dirs