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