Refactor checxbox event