Added global variables and action listeners