Removed useless loop in checkbox function