Merge pull request #38 from Daytron/master

Better implementation of issue 36