split file logic