Add stat namespace prefix option, and minor code cleanup