removed all possible memory leaks