Fixed bugs and built test harness for offline testing