Converted https://github.com/timvideos/planet/commit/7b440cc416ce9fa7c934be69cb0bf90618af7dbf