re
Your code seems to be more complex that it needs to be and so, TBH, I'd basically start again.
Keep it simple to just matching up your cloud variable names to a sub-topic (do you know about sub topics?) of your main topic
And completely scrap the x/y stuff (I've no idea what that is about!)