Updated extract to handle tag extraction