Revise method for creating connection to files