Refactor Brain class