Centralizers in rings