changed calculation of box-size, now more accurate