added capture logic