memory fixes
minor fixes of style, namespace, redeclared fields