refactoring is done for support multiple buttons.