UPDATE: depralallised everything and adjusted a few bits here and there to avoid memory overheads