Simplify retry logic for ui helper functions

@wedaly