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