added whitelist function
some cleanup