Fixed various bugs, added some stuff.