kept the code for both possible approaches wrt checkboxes