Converted https://github.com/timvideos/planet/commit/967f37803e5a5fec18e739c5d3d64a2fe89ef9a2