Rewrite brain module as a class