added changes for checking event origin