more generic width calc
left in old line for ref