fixed typos
cleaned some code