Converted https://github.com/timvideos/planet/commit/8baca1ef798e6a04c956ce1defad8e6a71137e6e