fixed some bugs and chaged how i outputted the files