Simplified code
Merge pull request #1108 from alex/simplify-code

Simplified code