Simplify some code
Merge pull request #489 from alex/patch-1

Simplify some code