Moving code out of Client and into ui