Updated version with correct whitelisting