Intermediate checkin of some refactoring to handle toggle buttons and potentially other button types.  Some other cleanup done as well.