Now it's finally fucking working. I can rest peacefully.  Althouth there's a print statement that will somehow break the whole fucking thing if we remove it, and I have no idea what that's all about