Fixed some code duplication

New class created to avoid code duplication with buttons