simplified reverse list algo