The comment at the start of this function is not enough to explain the next 10 lines or so. I have no idea what you're doing here.  If I go look up updateOnscreen I'll be able to figure it out, but I'd prefer a comment.