reduce number of function calls