Refactors some checkbox initialization code.