Added js to buttons to change text alignment
Refactored button .js for readability