added events to each function to react when the newly added buttons
are "clicked"