create func build and optimize