Optimize reading of file