updated implementation
added test harness