Expanded to use masking and output as CSV for Rajen