Fixed some points of slowness pointed out by the loomscript profiler