defined all needed functions - need to put variables in the event