Fixed some more logic and typos