This took more time than I wish to admit it took.