Add check privileges, and several changes.