Converted https://github.com/timvideos/planet/commit/665c9b1c14217a95a0e2d892b412e6452c2b5085