updated folder sorting and file naming, cleaned up code, added some commenting