Fixed some typos & minor refactor