Better sample, better es error handling