Manually merged some of Tyler's bug fixes, as well as changed some minor things.