Cleaning - my function so far. Not done. It runs but the structure for the output is not correct