I am trying to solve something that looked pretty straightforward at the beginning, but has developed into a little nightmare. I was able to code parts of the functionality desc