Refactored loadfolder for easier use as module

loadFiles now takes all its inputs rather than just args