deleteNode refind to prevent memory leak and better readability