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