Brieman cat branch

This loop is duplicated, can be factored out