File handling and string manipulations