Change a.button to button and removed some unnecessary code