Tons of fixes!
Merge pull request #1 from shadowjay1/master

added shadowjay1's changes.