cleaning up some algorithms in list to use mutation in favor of avoiding extra allocations