moved namespace creation to set function and stripped out extraneous returns