Move size logic into its own function...

I moved the size logic into the setSize function. setSize is then called
by render(). I also included the code to properly detect a change event,
as referenced by issue #85 and pull request #76.