typos, renamed some variables
typos