Growth optimization and electronic structure of ultrathin CoO films on Ag(001): A LEED and photoemission study