move function to get data to a separte module