added some doctests, removed unused gluon import
converted display labels to use underscores for space (seems to work better with jQuery) and some refactoring inspired by pylint