handle custom events and sample