Changed the addTail() method using getTail() method