simplified WriteBoxSize function