fixed some typos, credited code