initialized the function to detect checked states