Factoring out ui into pieceweb