Fix whitelisting functionality, tests to follow