Cleaned code; allow_notifications now uses preferences setting