Better memory cleaning, added shot pointers