corrected for the optimize method returning null, when bypassing structure.