Better implementation of issue 36
Merge pull request #38 from Daytron/master

Better implementation of issue 36