Converted https://github.com/timvideos/planet/commit/2d028504d60b8a45312502c796601bb14513082d