Add actions for first and last buttons.