Event processing was moved to the end. Added saving of events to file in an internal thread. ExecHandler class was redesigned.