multiple fixes

Eliminated all warnings, parameterized arguments, added logging, error
handling, cleaned up code, etc
Merge pull request #12 from taedixon/master

multiple fixes