Reduce number of function calls