So what does it do instead?

I just took a copy of your code and tried to run it. It doesn't paint correctly, so I would start there.