using cached variables instead of recalculating them