some functions can be used for optimization