add functions to compute width/height