Fixed calls to dealloc. Now all the objects are release properly.