finished functionality of buttons and backend