Merge pull request #1 from nickie/master

Simplifications and code review