fix original naming
misc warning fix and a bit of refactoring