Rework brain to be multi-brain capable. Also use new provider API.