re DS-598: interim commit, added Graham Triggs suggested code, need to figure out what can be removed