use promises to make sure data arrives on time