Simplifying leak fix and getting rid of early return.