Merging @tgkokk's PR with modification

https://github.com/jingweno/gh/pull/38