Fixed up some bugs and typos