Brieman cat branch

This loop is duplicated and can be factored out