The freeSlot function was only called once so I inlined the logic and utilized some of the other locals that were in scope.