namespace reorg and various fixes