Improved box checking and heuristics