Added functions for handling buton presses