Improve box detection