Rewrote check_privilege module.