It is difficult to understand threads and event handling .