move data functions to service