Converted https://github.com/timvideos/planet/commit/e3ded3b3cb2e72d23da189cb4961f50a2a6d89fd