Added function to print elements in  reverse order