created class and functions for events and applied on front-end