Optimizes functions to not create arrays