Fixed small typo's and logic errors