more cleanup to match code in master branch