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