Add functionality to buttons, and some other minor changes.