Refactor grid clear utility