Updated code

This one handles files of any size