Updated to Bill's latest code fixes