added reverse list algorithm