Fixing some bugs and adding some stuff.