Renamed 'refresh' to 'repaint' to be more explicit.
Moved component search logic into method.
Added JSDoc comments.

Can now generate documentation with the jsdoc tool.
Refactor: Made variable name more explicit.