after debugging changing things to shared ptrs