Don't repeat yourself!
$contacts may be not initialized.