using promises and precomputing contours