Fixed some typos, changed code slightly