Added csv output and directory processing