Use inNamespace instead of checking for namespace manually

Change-Id: I291731e565c2e3556602764074778e2bfe0eb965