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