name functions for easier debug, also reduce more temporary variables