Fix some merge problems with duplicate names and refactors
Make some minor changes to eliminate compiler warnings