Enabled privacy functionality. Revised and refactored code to improve performance and readability.