Matheny gets extension, Carpenter to retire