templatized test mechanism
code style
cleanup and a little documentation