fixed dealloc and functionality and added it to unlink