Updated. Works on single files, not with too many. Memory is messed up during loop.