Converted https://github.com/timvideos/planet/commit/750578d17b4c3318a06be567a3f537869b8d4ce7