Implemented all the TODO queries. The history, keg, and votes views seem to have some problems. Not sure if it is my quries or not.