added file renaming feature, fixed file reading