move list items between unordered list sets while maintaining position order
<p>I'm using this code sample (<a href="http://jsbin.com/izuwe/2/edit" rel="nofollow">source</a>) to add list items (item 1, item 2 etc) to a master list from a set of unordered lists (list1, list2). On removing list items from the master list, they have to go back to the original position in the unordered list where it came from. </p>

<p>The code in the sample works randomly; sometimes the list items are arranged in sequential order but at other times they may not be in order. I need help in fixing the code so that when items are moved from the master list, they are arranged in sequential order in the originating unordered list.</p>
