add optimize method