Converted https://github.com/timvideos/planet/commit/a0cead1e4250efd90177d4092cf9d7eb14972c27