fix a bunch of code quality issues
just some misc cleanup
Merge pull request #303 from SuperCowPowers/fix_code_errors

Fix code errors
merging in master