moved button refresh code to callbackWithResult: