Use refinements, with a little less boilerplate