add waitfortwo function