Changed back from vectors and pointers to maps and it is working now