Complete the remove method for case of removing node with 2 nodes
Refactoring the remove method to reduce the code complexity