Added whitelist code, needs testing