Improve previous optimize