wrapped inserting UI buttons in defer, tried to implement waitOn utility