Added electron-event pairs and a "closest" function for selecting the closest
object to another object.