code in last b post adjusted