cleanup and nmespace fixes