Sanitized the code and logging mechanism