Added the validateItem function.