complete rewrite, whitelist approach