Nilujes fixes

This combines what is in PR #1199 - just rebased and some commits squashed with their fix-up commits.