Converted https://github.com/timvideos/planet/commit/1ab0ca59e17ad66415601b498a1ed407e2ad0782