Bugs fixed. Code is ready to be run for large-scale data collection