Bug fix for checked state on click

I noticed you had to click twice to change the checked state with the setup code I originally added so I added a fix in the click event handler.  Also cleaned up with ternary conditional expression.