Apply solution to master issue  #9

Solution from @daniel-j-h, signed off by @petsagouris