added function for when panels are clicked