avoiding casts - could be more DRY
Merge pull request #14 from freekh/freekh-minor-code-fixes

misc minor code fixes