moving data functions to api where they belong