added buttons for testing; code improvements