Completed medium 23

This proved impossible for me to do without cloning the list.
A little messy, works well enough for me.