Viewport width height and some code cleaning.

The important change in this pull request is the first commit (new variables for the Width and Height of the viewport).
The rest is some code cleaning.