start rewrite to just retrieve data and use lapply