Revised code for defects