Added onShow/Close events. Fixed some bugs