some of the code is the same in both branches.
also if you remove the list extra layer you can simplify a little