Export output logic in separate module
Added directory traversal