Refactor lib/getFiles

Some refactor of lib/getFiles, for if #94 is pulled. Then this needs to be rebased before pulling.