todo: build a test harness for this