Add wait element function