Added optional 'context' to selector ($$) function
Use selector function where possible to reduce double-code
Optimize event handling code