Reduced the code required for dealing with checkbox events