Fixed bug that caused too many accesses to the db

the problem was using .click() instead of .on(). too many
eventListeners were being created which caused way too many db
accesses. Implementing on() fixed this