Reworked namespace handling and allow to override demand-load flag.

Change-Id: I772981a2e5da5eb94b7ee5d0c317dc211c5b8beb