File reading function works