Brought back some previously-removed inefficient code to stop overflowing everything; not done yet