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