Minor bug and typo fixes and cleaning up