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