avoid loop (i.e., make the function faster)