1) A lot of stuff is happening in this function, which makes it hard to test. It should be broken down into various smaller functions. 2) Additionnally, we should review the necessity of having a list with so many items as an output of this function. Do we use all of them?