Code reorg and adding some comments
Rebuild and merge