Rename objectPair to pair
Remove unneeded braces from if statement
Add some documentation for a few methods
Move event handlers to nested functions in the constructor