Speed improvements by slicing file before processing