Added gauge for buttons and refactored the code