crude in some ways, but it works.