Refactored button code
refactored buttonstuff