added code to enable checking and unchecking programmatically