Added anonymous inner classes to handle button clicks.