shortened code in testButton method and added a comment