freeing memory
implementing copy implementation
bfs modifications for memory corrections