Partial refactoring of button into a class