Extract function for making the boxes