Update

-Fixed coding style
-Fixed nullptr issues
-Still another nullptr issue from BRAIN