Refactor brain worker as seperate class