PM-695 better event handling in js
formatting