Refactor for a generic button