Added custom directory output handling