Added specific namespace replacing only. Added protection for no namespace.