Cleaned up code in boxes.js