Simplify file reading function