implementing events functions