fixing read issues as well as adding in ability to output to a set directory