added some logic to the contacts table