Refactoring to support token refresh and converting of raw file data.