added capture code