Updated code based on videp