Added some code for data collection
Some more debug stuff