Reduces the number of instantiated object when using function