Implement basic badge functionality and fix a few other things