Changed button listener to a single function.