removing extra heap allocations