Added button handling code.

Updated UI, too.