Added a flag variable

The flag is used to decide what data to process.