Code for reversing elements in lists.