Fixed some bugs and added some stuff.