added comments
added inner event handler