Moved most click listeners into function. Will later try to use promise to lock this down