Added updated capture code