I don't want to scare you but i felt i should mention this story-
I knew a family with a lovely young cat who started pooping outside the box, this was years ago. They were at their wit's end and began to 'punish' the poor cat (something I would never have done for sure). Finally the cat was getting ill and the vet found it had a large brain tumor and that was the reason. It had to be put to sleep but the woman felt terrible guilt about shaming and punishing the poor cat when it really was just terribly ill. Sorry, what an awful story. But I wanted to make sure people understood that sometimes the cat really cannot help it and it sometimes is not a behavior/habit issue at all.