fixed a ton of bugs
code review changes
Merge pull request #133 from dcs24/master

Bug fixes