fixed up topic stuff (and added tests), did some other cleaning up