Reworked the namespace calculation