Reversing a list operation