Code cleanup commit built on the top of the pull request from udat.