Split files and improved algorithm