added necessary code to calculate box size