Further tweaks to work with BNU-ESM; code cleanup