remove empty space at end of list implementation.