Small refactor and added output directory