added logic to remove layer when box is unchecked