Converted https://github.com/timvideos/planet/commit/72e03c5c47848b4e018267b26ef2cdea632095d2