Fix some bugs and make some things nicer