simplify code to make it easier to merge GH-75