added .gitignore
style fixes
fixed typos
moved code into 'for' loop that should have already been there