minor refactoring of transformObject