moved event handlers to models.js