Use for loops and less function arguments