Remove newlines at the end of list items + tests