modify and optimize