Properly implemented read file method