Fixed up a few bugs and made some changes.