Fixed bugs and typos all over the place.