separated out the file functionality into a separate class