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