linked the buttons to changed the title and cleaned up code