extra functions for event handling and buttons

creating more general solutions to reduce the repeated code