Code improvement for #197

Improved code from pull request #197 as suggested by @stanio
Merge pull request #200 from markhop/code_improvement_197

Code improvement for #197
Indentation fix.