Code cleanup and namespace change