Issue 65 code review

@demarey ... here's the pull request where I will review the changes and make comments about what should be done for portabilit ...