Converted https://github.com/timvideos/planet/commit/550c8faba63958b143a8885fb84c254118e20bd5