new function for reading local files. performance improvement.