Add test data and fix some bugs