Code review: namespace and several cleanups
Code review: cleanups and minor changes