added data collection code