Converted https://github.com/timvideos/planet/commit/01e8da8ea3c5b9c5da372a864545bba58b334a5d