Spent three hours doing this yesterday, thanks to @nomadic_habit...