Refactoring code and added all the buttons