Optimize the migrate-cache2.script a bit to perform less I/O operations