created a method for data collection