refactoring input handling
button class