Added changes proposed by @anhsaker
fixes #7