fixed namespace trim, code reformated, tests refactored