adding code to make buttons work