Moved code for registering button click handlers to make the UI easier to customise.