Moved the data function separately to prepare for caching