added debug flag for outputs defaults to false